<template>
  <div class="payment_status">
    <div class="status_top">
      <div>请扫码支付</div>
    </div>

    <img v-bind:src="url" width="100px" height="100px"/>

    <div class="status_goLink">
      <router-link class="red" :to="{name: 'index'}">返回首页
        <van-icon name="arrow"/>
      </router-link>
    </div>
  </div>
</template>

<script>
import { getQrCode, paymentStatus } from '@/api/api';
// import { setInterval } from 'timers';

export default {
  data() {
    return {
      order: {
        orderInfo: {},
        orderGoods: []
      },
      url: "",
      // timer:"",
      orderId: this.$route.params.orderId
    };
  },
  methods: {
    submitOrder(){
      getQrCode({orderId: this.orderId}).then( res=> {
        console.log("二维码");
      })
    },
    // pollingReturn() {   
    //   paymentStatus().then(res => {
    //     if(res == 0){
    //       return;
    //     }else{
    //       if(res == 1){
    //         this.$router.push({
    //           name: 'paymentStatus',
    //           params: {
    //             status: 'success'
    //           }
    //         })
    //       }
    //     }
    //   })
    // }
  },
  mounted:function(){
    this.url="http://localhost:8080/wx/order/getQrCode?orderId="+this.orderId
//     this.timer = setInterval(this.pollingReturn(),3000)
 },
// beforeDestroy(){
//   clearInterval(this.timer);
// }
};
</script>


<style lang="scss" scopd>
.payment_status {
  padding-top: 30px;
  box-sizing: border-box;
  background-color: #fff;
  text-align: center;
}

.status_top {
  margin-bottom: 15px;
  i {
    margin-bottom: 5px;
  }
  > div {
    font-size: 18px;
  }
}

.status_text {
  color: $font-color-gray;
  margin-bottom: 50px;
}

.status_icon {
  font-size: 80px;
}

i.success_icon {
  @extend .status_icon;
  color: #06bf04;
}

i.fail_icon {
  @extend .status_icon;
  color: #f44;
}
</style>
